
include $(TOP_DIR)/build/common.mk

TARGET_client = sample_ldt_ioctrl_cli
SRC_client = sample_ldt_ioctrl_cli.c

TARGET_device = sample_ldt_ioctrl_dev
SRC_device = sample_ldt_ioctrl_dev.c

LOCAL_INCLUDE = -I$(OUT_DIR)/include \
	-I$(TOP_DIR)/framework/base/lindutils

LOCAL_LIBRIARY = -L$(OUT_DIR)/lib/ \
	-lpthread -lldutils -lldtunnel

SRC = $(wildcard *.c)

ifeq ($(HOST_ARCH) , x86_64)
LOCAL_CFLAGS += -m64 -Dx86_64 -lws2_32
endif

ifeq ($(HOST_ARCH) , x86_32)
LOCAL_CFLAGS += -m32 -Dx86_32 -lws2_32
endif

all:
	$(CC) $(SRC_client) -o $(TARGET_client) $(LOCAL_LIBRIARY) $(LOCAL_INCLUDE) $(LOCAL_CFLAGS) -Wl,--allow-shlib-undefined
	mv $(TARGET_client) $(OUT_DIR)/bin/$(TARGET_client)

	$(CC) $(SRC_device) -o $(TARGET_device) $(LOCAL_LIBRIARY) $(LOCAL_INCLUDE) $(LOCAL_CFLAGS) -Wl,--allow-shlib-undefined
	mv $(TARGET_device) $(OUT_DIR)/bin/$(TARGET_device)

clean:
	rm -rf $(OUT_DIR)/bin/$(TARGET_client)
	rm -rf $(OUT_DIR)/bin/$(TARGET_device)
